package com.alibaba.citrus.cr.platform.enhance.repository.impl;

import java.util.List;

import javax.annotation.Resource;

import com.alibaba.citrus.cr.common.annotation.RepositoryInvoker;
import com.alibaba.citrus.cr.platform.enhance.repository.RegionRepository;
import com.alibaba.lattice2.epoch.sdk.model.Result;

import com.epoch.app.bcorder.model.dto.GetRegionByCodesRequest;
import com.epoch.app.bcorder.model.dto.RegionSDO;
import com.epoch.app.bcorder.service.BaseDataService;
import org.springframework.stereotype.Component;

/**
 * @author zhoubc
 * @description: TODO
 * @date 2021/11/22 20:09
 */
@Component
public class RegionRepositoryImpl implements RegionRepository {

    @Resource
    BaseDataService baseDataService;

    @Override
    @RepositoryInvoker
    public List<RegionSDO> batchQueryRegionByCodes(List<String> regionCodes) {
        GetRegionByCodesRequest getRegionByCodesRequest = new GetRegionByCodesRequest();
        getRegionByCodesRequest.setRegionCodes(regionCodes);
        Result<List<com.epoch.app.bcorder.model.dto.RegionSDO>> result = baseDataService.getRegionByCodes(getRegionByCodesRequest);
        return result.getResult();
    }

}
